import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) {
        ServerSocket ss = null;
        try {
            ss = new ServerSocket(3333);
            Socket s = ss.accept();
            if (s != null) {
                BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
                System.out.println(br.readLine());
                //回应客户端信息
                BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
                bw.write("hi");
                bw.flush();
                br.close();
                bw.close();
                ss.close();
                s.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
